﻿@model Retete.ViewModels.VanzariViewModel
@{
    ViewBag.Title = "Vanzari";
}

<script type="text/javascript">
    function stergeInregistrare(id) {
        if (confirm("Doriti sa stergeti vanzarea selectata?") == true) {
            IDElementSters.value = id;
            form.submit();
        }
    }
</script>

@using (Html.BeginForm(null, null, FormMethod.Post, new { id = "form", name = "form" }))
{
    <table style="width: 100%">
        <tr>
            <td style="width: 190px; vertical-align: top; border-right-style: dashed; border-right-color: #CFCFCF; border-right-width: 1px;">
                <fieldset>
                    <legend>Rapoarte</legend>

                    <p class="toolbox">@Html.ActionLink("Centralizator vanzari", "CentralizatorVanzari")</p>
                    <p class="toolbox">@Html.ActionLink("Bon consum", "BonConsum")</p>
                    <p class="toolbox">@Html.ActionLink("Raport de productie", "RaportProductie")</p>
                    <p class="toolbox">@Html.ActionLink("Balanta stocuri", "BalantaStocuri")</p>
                    <p class="toolbox">@Html.ActionLink("Raport de gestiune bauturi", "RaportGestiuneBauturi")</p>
                </fieldset>

                <fieldset>
                    <legend>Selectare data</legend>

                    <p>@Html.Calendar(DateTime.Today.AddMonths(-1).Year, DateTime.Today.AddMonths(-1).Month, Model.SelectedDate)</p>
                    <p>@Html.Calendar(DateTime.Today.Year, DateTime.Today.Month, Model.SelectedDate)</p>
                </fieldset>
            </td>
            <td style="vertical-align: top;">
                <fieldset>
                    @Html.HiddenFor(model => model.IDElementSters)

                    <legend>Vanzarile de azi</legend>

                    <table class="grid">
                        <thead>
                            <tr>
                                <th style="width: 16px"></th>
                                <th style="width: 150px">Tip vanzare</th>
                                <th>Client</th>
                                <th style="width: 139px">Valoare</th>
                            </tr>
                        </thead>

                        <tbody>
                            @foreach (var element in Model.Vanzari)
                            {
                                <tr>
                                    <td><img src="@Url.Content("~/Content/Images/Delete.png")" alt="Sterge" style="height: 12px; cursor: pointer;" onclick="stergeInregistrare(@element.ID)" /></td>
                                    <td>@element.Tip</td>
                                    <td>@Html.ActionLink(string.IsNullOrEmpty(@element.ClientNume) == true ? "Client anonim" : @element.ClientNume, "Details", new { id = @element.ID })</td>
                                    <td>@element.Valoare.ToString("0.00")</td>
                                </tr>
                            }

                            <tr class="totals">
                                <td>&nbsp;</td>
                                <td>&nbsp;</td>
                                <td>Total:</td>
                                <td>@Model.Valoare.ToString("0.00")</td>
                            </tr>
                            <tr class="totals">
                                <td>&nbsp;</td>
                                <td>&nbsp;</td>
                                <td>Total casa:</td>
                                <td>@Model.ValoareCasa.ToString("0.00")</td>
                            </tr>
                        </tbody>
                    </table>
                </fieldset>
            </td>
        </tr>
    </table>
}